package com.business.service.cms;

import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page;
import org.springside.modules.orm.PropertyFilter;
import com.business.dao.cms.ArticleDao;
import com.business.entity.cms.Article;

@Component
@Transactional
public class ArticleService {
	private static Logger logger = LoggerFactory.getLogger(ArticleService.class);
	private ArticleDao ArticleDao;
	
	/**
	 * 涓婚敭鑾峰彇瀵硅薄
	 */
	@Transactional(readOnly = true)
	public Article getArticle(Long id) {
		return ArticleDao.get(id);
	}

	/**
	 * 娣诲姞鎴栬€呬慨鏀瑰璞?
	 * @param entity
	 */
	public void saveArticle(Article entity) {
		ArticleDao.save(entity);
	}
	
	/**
	 * 鍒犻櫎瀵硅薄
	 */
	public void deleteArticle(Long id) {
		ArticleDao.delete(id);
	}
	
	/**
	 * 浣跨敤灞炴€ц繃婊ゆ潯浠舵煡璇?
	 */
	@Transactional(readOnly = true)
	public Page<Article> searchArticle(final Page<Article> page, final List<PropertyFilter> filters) {
		return ArticleDao.findPage(page, filters);
	}
	
	public static Logger getLogger() {
		return logger;
	}
	public static void setLogger(Logger logger) {
		ArticleService.logger = logger;
	}
	
	@Autowired
	public ArticleDao getArticleDao() {
		return ArticleDao;
	}
	
	
	
}

